home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 7 / Eagles_Nest_Mac_Collection_Disc_7.TOAST / Text Editors & Tools / HTMLEdit11 / HTML.edit 1.1 ƒ / HTML.edit v1.1 / stack_-1.xml < prev    next >
Extensible Markup Language  |  1994-05-04  |  22KB  |  25 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in.1</name>
  5.     <id>-1</id>
  6.     <cardCount>5</cardCount>
  7.     <cardID>2292</cardID>
  8.     <listID>2591</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>640</width>
  14.         <height>640</height>
  15.     </cardSize>
  16.     <script>-- HTML.edit version 1.1 copyright 1994 by Murray M. Altheimon startuphide scroll windowshowAbout 3setMenuscheckForMissingFont "Futura" -- inform user of missing font "Futura"pass startupend startupon setMenuslock screenset the name of menuItem 1 of menu "Apple" to "About HTML.edit‚Ķ"set the menuMessage of menuItem 1 of menu "Apple" to showAboutput "New Document" into menuItem 1 of menu "File"put "Import Document" into menuItem 2 of menu "File"put "Export Document" into menuItem 3 of menu "File"put "Quit HTML.edit" into last menuItem of menu "File"enable first menuItem of menu "File"enable second menuItem of menu "File"disable third menuItem of menu "File"set the menuMessage of menuItem 1 of menu "File" to newDocumentset the menuMessage of menuItem 2 of menu "File" to importHTMLset the menuMessage of menuItem 3 of menu "File" to exportHTMLset the menuMessage of last menuItem of menu "File" to "doMenu"&&quote&"Quit HyperCard"&quoteset the commandChar of menuItem 1 of menu "File" to "N"set the commandChar of menuItem 2 of menu "File" to "O"set the commandChar of menuItem 3 of menu "File" to "S"set the commandChar of last menuItem of menu "File" to "Q"unlock screenend setMenuson openStackglobal useHTMLReturn,useCommentFld,indexed,indexUpdated,autoToolsglobal HTMLToolsWereViz,HTMLColorToolsWereViz,toolsWereViz,patsWereViz,msgWasVizglobal fileCreator,dateFormat,wrapText,autoCompact,compactThresholdput the hilite of cd btn id 4 of cd "Preferences" into useHTMLReturn -- option-Return = <P>set the textArrows to hilite of cd btn id 5 of cd "Preferences" -- Arrow keys in textput the hilite of cd btn id 17 of cd "Preferences" into wrapText -- wrap editor textput the hilite of cd btn id 6 of cd "Preferences" into autoTools -- option-Return = <P>put the hilite of cd btn id 9 of cd "Preferences" into autoCompact -- compact stack on quitput cd fld "fileCreator" of cd "Preferences" into fileCreator -- creator for exportput setCompactThreshold() into compactThreshold -- compact stack if freeSize > thresholdput the short name of cd btn id 58 of cd "masterFooters" into dateFormat -- format of date stringput FALSE into HTMLToolsWereVizput FALSE into HTMLColorToolsWereVizput viz("tools") into toolsWereVizput viz("patterns") into patsWereVizput the visible of msg into msgWasVizput FALSE into indexUpdatedpass openStackend openStackon closeStackglobal autoCompactif autoCompact then compactStackif there is a window "HTMLTools" then close window "HTMLTools"if there is a window "HTMLColorTools" then close window "HTMLColorTools"pass closeStackend closeStackon appleEvent theClass,theID,theSenderplay "dink" f4s aset lockErrorDialogs to TRUEget the itemDelimiterset the itemDelimiter to colonput last item of theSender into sendingProgramset the itemDelimiter to itif theClass is "aevt" and theID is "odoc" and sendingProgram is "Finder" thenset cursor to watchrequest appleEvent dataif it = empty then exit appleEventput it into fNameListgo cd (number(cds in bg "Editor"))-2 of bg "Editor"repeat with i = 1 to the number of lines of fNameListsend "importHTML"&&quote&(line i of fNameList)&quote to this cdend repeatend if -- pass appleEventend appleEventon errorDialog whichErroranswer "HTML.edit Error:"&return&"‚Äú"&whichError&"‚Äù"end errorDialog---- ‚Ä¢ standardon doMenu iif i = "New Background" then beepelse if i = "Import Document..." thengo cd (number(cds in bg "Editor"))-2 of bg "Editor"send "importHTML" to this cdelse if i = "Export Document..." thenget number(this cd)if (it = 1) or (it > (number(cds)-3)) then beepelse send "exportHTML" to this cdelse pass doMenuend doMenuon newCardglobal indexUpdatedput FALSE into indexUpdatedpass newCardend newCardon deleteCardglobal indexUpdatedput FALSE into indexUpdatedpass deleteCardend deleteCardon idleif there is a window "progress" then close window "progress"pass idleend idleon showAbout theTimeif theTime = empty then put 999 into theTimeget line 1 of getMode()if (item 1 of it = "B") and (item 2 of it = 1) then showWind "AboutBoxBW",theTime -- B&W AboutBoxelse showWind "AboutBox",theTime -- Color AboutBoxend showAbouton showWind wind,timeget the tickspicture wind,resource,shadowif there is no window wind then answer "OUT OF MEMORY ERROR:"&return&"Unable to display graphic. Allocate more memory to this application."else wait until the mouseClick or the ticks - it > (time * 60)lock screenif there is a window wind then close window windunlock screen with zoom closeend showWindon mouseDownInPicture windif wind = "AboutBox" then close window "AboutBox"if wind = "AboutBoxBW" then close window "AboutBoxBW"if wind = "PaletteHelp" then close window "PaletteHelp"end mouseDownInPictureon compactStackglobal compactThresholdif the freeSize of this stack/the size of this stack > compactThreshold then doMenu "Compact Stack"end compactStackon printTextopen report printing with template "PrintDocument"print this cdclose printingend printText-- ‚Ä¢on indexStackglobal indexUpdated,indexList,cardIDListif the short id of this cd = 2292 then put empty into cd fld "Index"push cdlock screenlock messagesgo cd id 2292 -- index cardput empty into indexListput empty into cd fld "Index"put empty into charCountListput empty into cd fld "charCountList"put empty into lastSavedListput empty into cd fld "lastSavedList"put empty into cardIDListput empty into cd fld "cardIDList"go first cd of bg "Editor"put number(cds in this bg)-2 into endOpif endOp > 3 -- card threshold for using thermometerthen progressWindow "¬©Dome","Progress","Indexing documents‚Ķ"&return&"Type ‚åò-. to halt processing.",4130repeat with i = 1 to endOpgo cd i of this bgput the short id of this cd&return after cardIDListput fld "title"&return after indexListput number(chars in fld id 1)+number(chars in fld id 2)+number(chars in fld id 3)&¬¨" chars"&return after charCountListif fld id 10 ‚↠empty then get fld id 10 else get "not saved"put it&return after lastSavedListif there is a window "Progress" then set thePercent of window "Progress" to (i/endOp)*100 else bzend repeatgo cd id 2292if last char of indexList = return then delete last char of indexListput indexList into cd fld "Index"put return after indexListput cardIDList into cd fld "cardIDList"put charCountList into cd fld "charCountList"put lastSavedList into cd fld "lastSavedList"bzif viz("Progress") then close window "Progress"put TRUE into indexUpdatedpop cdunlock screenend indexStack-- ‚Ä¢ HTML Codingon parseHTML -- add <HTML> codes only if they exist somewhere in HBFlock screenif deleteHTML("<HTML>") > 0 then -- there were some codes, so add 'em backif first char of fld "header" ‚↠return and fld "header" ‚↠empty then put return before fld "header"put "<HTML>" before fld "header"if last char of fld "footer" ‚↠return and fld "footer" ‚↠empty then put return after fld "footer"put "</HTML>" after fld "footer"end ifunlock screenend parseHTMLon parseHEADif ("<HEAD>" is in fld "header") or ("</HEAD>" is in fld "header") thenprocessError "There is at least one <HEAD> tag already in the document header. Please check your syntax."elseput offset("<HEAD>",fld "body") into startHEADput offset("</HEAD>",fld "body") into endHEADif startHEAD = 0 and endHEAD = 0 then wait 0 -- noop: there are no HEAD codeselse if startHEAD = 0 and endHEAD ‚↠0 thenprocessError "Missing start tag ‚Äú<HEAD>‚Äù for header. There is an end tag ‚Äú</HEAD>‚Äù in the document body."else if startHEAD ‚↠0 and endHead = 0 thenprocessError "Missing end tag ‚Äú</HEAD>‚Äù for header. There is an start tag ‚Äú<HEAD>‚Äù in the document body."else if startHEAD ‚â• endHEAD thenprocessError "End tag ‚Äú</HEAD>‚Äù occurs before start tag ‚Äú<HEAD>‚Äù in the document."else -- OK syntaxget char startHEAD to (endHEAD+6) of fld "body"put it after fld "header"delete char startHEAD to (endHEAD+6) of fld "body"if char 1 of fld "body" is return then delete char 1 of fld "body"end ifend ifend parseHEADon parseFOOT -- move everything past </BODY> to footerif "</BODY>" is in fld "body" thenput offset("</BODY>",fld "body")+7 into startFOOTput length(fld "body") into endFOOTput char startFOOT to endFOOT of fld "body" into fld "footer"delete char startFOOT to endFOOT of fld "body"end ifend parseFOOTon HTMLLanguage -- remove current <HTML> as extraneous then replace in correct placelock screenget deleteHTML("<HTML>")if first char of fld "header" ‚↠return and fld "header" ‚↠empty then put return before fld "header"put "<HTML>" before fld "header"if last char of fld "footer" ‚↠return and fld "footer" ‚↠empty then put return after fld "footer"put "</HTML>" after fld "footer"unlock screenend HTMLLanguageon HTMLHeader -- add tags to headerif "<HEAD>" is not in fld "header" thenif "<HTML>" is in fld "header" then put return&"<HEAD>" after char (offset("<HTML>",fld "header")+5) of fld "header"else put "<HEAD>" before fld "header"end ifif "</HEAD>" is not in fld "header" thenif last char of fld "header" ‚↠return then put return after fld "header"put "</HEAD>" after fld "header"end ifend HTMLHeaderon HTMLTitleask "Enter the online title for this document:" with "Document Title"if it ‚↠empty then get "<TITLE>"&it&"</TITLE>"else exit HTMLTitleif "<TITLE>" is in fld "header" and "</TITLE>" is in fld "header" thenput it into char offset("<TITLE>",fld "header") to (offset("</TITLE>",fld "header")+7) of fld "header"else if "<HEAD>" is in fld "header" then put return&it after char (offset("<HEAD>",fld "header")+5) of fld "header"else if "<HTML>" is in fld "header" then put return&it after char (offset("<HTML>",fld "header")+5) of fld "header"else put it before fld "header"end HTMLTitleon HTMLComment -- in progress. comments the selection.put word 2 of the selectedLine into currentLineput line currentLine of the target into lineTextrepeat with i = 1 to number(lines in the target) + 1if line i of the target is empty then next repeatif char 1 to 4 of line i of the target is not "<!--" then put "<!-- " before line i of the targetif last char of line i of the target is not ">" then put " >" after line i of the targetend repeatcharacterCountif currentLine > 0 then do "select after line"&&currentLine&&"of the target"end HTMLCommenton HTMLBodylock screenget deleteHTML("<BODY>")if "<BODY>" is not in fld "body" then put "<BODY>"&return before fld "body"if "</BODY>" is not in fld "body" thenif last char of fld "body" ‚↠return then put return after fld "body"put "</BODY>" after fld "body"end ifunlock screenend HTMLBodyon HTML i -- modify text selection with HTML codesglobal headingNumberIF i = "Image..." then HTMLImageELSE if not emptySelection() then -- make sure some text was selectedget emptyif i = "Bold" then get "<B>"&","&"</B>"else if i = "Citation" then get "<CITE>"&","&"</CITE>"else if i = "Comment" then get "<!-- "&","&" >"else if i = "Emphasis" then get "<EM>"&","&"</EM>"else if i = "Italic" then get "<I>"&","&"</I>"else if i = "Listing" then get "<LISTING>"&","&"</LISTING>"else if i = "Plain Text" then get "<CODE>"&","&"</CODE>"else if i = "Strong Emphasis" then get "<STRONG>"&","&"</STRONG>"else if i = "Typewriter" then get "<TT>"&","&"</TT>"else if i = "Preformatted" then get "<PRE>"&","&"</PRE>"else if i = "Title" then get "<TITLE>"&","&"</TITLE>"else if i = "Underline" then get "<U>"&","&"</U>"else if i = "Heading" then get "<H"&headingNumber&">" & "," & "</H"&headingNumber&">"if it ‚↠empty then -- we've found the code, so modify the text:put item 1 of it before the selectionput item 2 of it after the selectionelse if i = "Address" then HTMLAddresselse if i = "Blockquote" then HTMLBlockquoteelse if i = "Bulleted List" then HTMLBulletedelse if i = "Short Date" then put "{Short Date}" into the selectionelse if i = "Abbreviated Date" then put "{Abbreviated Date}" into the selectionelse if i = "Long Date" then put "{Long Date}" into the selectionelse if i = "Glossary" then HTMLGlossaryelse if i = "Directory" then HTMLDirectoryelse if i = "Menu" then HTMLMenuelse if i = "Numbered List" then HTMLNumberedelse if i = "PLAINTEXT" then put "<PLAINTEXT>" after the selectionelseput "HTML ERROR: "&quote&i&quoteexit HTMLend ifEND IFend HTMLon HTMLGlossaryif emptySelection() then exit HTMLGlossaryput the selection into theTextput the number of lines of theText into nif n mod 2 ‚↠0 thenanswer "HTML ERROR:"&return&"The text selection for an HTML Glossary must be an even number "&¬¨"of lines. The first line of each pair is the term, the second line is the definition."elserepeat with i = 1 to nif i mod 2 is 0 then next repeatput "<DT>" before line i of theTextend repeatrepeat with i = 1 to nif i mod 2 is 1 then next repeatput "<DD>" before line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<DL>"&return&theText&"</DL>"&return into the selectionend ifend HTMLGlossaryon HTMLAddressif emptySelection() then exit HTMLAddresselse put the selection into theTextput the number of lines of theText into nrepeat with i = 1 to nput "<P>" after line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<ADDRESS>"&return&theText&"</ADDRESS>" into the selectionend HTMLAddresson HTMLBlockquoteif emptySelection() then exit HTMLBlockquoteelse put the selection into theTextif last char of theText ‚↠return then put return after theTextput "<BLOCKQUOTE>"&return&theText&"</BLOCKQUOTE>" into the selectionend HTMLBlockquoteon HTMLDirectoryput the selection into theTextrepeat with i = 1 to number(lines of theText)put "<LI>" before line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<DIR>"&return&theText&"</DIR>" into the selectionend HTMLDirectoryon HTMLImageIF the selection ‚↠empty thenanswer "Use the current text selection as the URL reference?" with "Cancel" or "Selection" or "Select File"if it = "Cancel" then exit HTMLImageelse if it = "Selection" thenput the selectedText into thePathput "<IMG SRC="&quote&replaceChar(":","/",thePath)&quote&">" into the selectionexit HTMLImageend if -- else ask for fileName:end ifanswer file "Select an image file: (GIF or JPEG)"if it ‚↠empty then put "<IMG SRC="&quote&replaceChar(":","/",it)&quote&">" after the selectionend HTMLImageon HTMLMenuput the selection into theTextrepeat with i = 1 to number(lines of theText)put "<LI>" before line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<MENU>"&return&theText&"</MENU>" into the selectionend HTMLMenuon HTMLBulletedput the selection into theTextrepeat with i = 1 to number(lines of theText)put "<LI>" before line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<UL>"&return&theText&"</UL>" into the selectionend HTMLBulletedon HTMLNumberedput the selection into theTextrepeat with i = 1 to number(lines of theText)put "<LI>" before line i of theTextend repeatif last char of theText ‚↠return then put return after theTextput "<OL>"&return&theText&"</OL>" into the selectionend HTMLNumberedfunction deleteHTML endCode-- given code <X>, delete all occurrences in H/B/F of <X> and </X>, returns count of changesput 0 into codeCountput endCode into startCodeput "/" after char 1 of endCoderepeat with i = 1 to 3repeat until (startCode is not in fld id i) and (endCode is not in fld id i)if startCode is in fld id i thenadd 1 to codeCountput offset(startCode,fld id i) into startHTMLdelete char startHTML to (startHTML+length(startCode)-1) of fld id iend ifif endCode is in fld id i thenadd 1 to codeCountput offset(endCode,fld id i) into endHTMLdelete char endHTML to (endHTML+length(endCode)-1) of fld id iend ifend repeatend repeatreturn codeCountend deleteHTMLon processError msganswer "HTML SYNTAX ERROR:"&return&msg&return&return&"The text parser will not process this HTML code." with "Continue"exit to HyperCardend processError---- ‚Ä¢ floating palette, utility and about boxeson checkForMissingFont theFontif there is not a menu "Font" then answer "Error: no font menu."else if there is no menuItem theFont in menu "Font" thenbeepanswer "This editor uses the "&theFont&" font, which is not installed. "&return&¬¨"If you don't install the "&theFont&" font, you can still use HTML.edit, but you may notice some cosmetic problems." with "Quit" or "OK"if it = "Quit" then quitend ifend checkForMissingFonton setFont n,sglobal wrapTextpush cdlock screenlock messagesgo cd 1 of bg "Editor"get "fld id 11,fld id 1,fld id 2,fld id 3" -- ,6388,cd fld id 7,cd fld id 8,cd fld id 9,2145,cd fld id 7,cd fld id 8,cd fld id 9"repeat with i = 1 to number of items in itif last word of item i of it > 100 thengo cd id (item i of it)next repeatend ifdo "set textFont of "&(item i of it)&" to "&ndo "set textSize of "&(item i of it)&" to "&sdo "set dontWrap of "&(item i of it)&" to not "&wrapTextend repeatgo cd "masterHeaders"setCdFont n,sgo cd "masterFooters"setCdFont n,spop cdset the name of cd btn id 3 to s&" pt"unlock screenplay "dink" d3send setFont---- ‚Ä¢ functionsfunction emptySelection -- make sure some text was selectedif the selection is empty thenanswer "You must select some text for this function to work."return TRUEelse return FALSEend emptySelectionfunction getStackName path -- returns the short stack name given pathrepeat with i = length(path) down to 1if char i of path = ":" thenget iexit repeatend ifend repeatreturn char (i+1) to (length(path)-1) of pathend getStackNamefunction getPath -- returns the path to this stackput the long name of this stack into pathrepeat with i = length(path) down to 1if char i of path = ":" thenget iexit repeatend ifend repeatreturn char 8 to i of pathend getPathfunction replaceChar a,b,container -- replace all char a with b of containerrepeatget offset(a,container)if it = 0 then exit repeatput b into char it of containerend repeatreturn containerend replaceCharfunction getDateText -- returns date text in spec formatglobal dateFormatdo "get the "&dateFormatreturn itend getDateTextfunction viz windowNameif there is a window windowName thenreturn (the visible of window windowName)else return FALSEend vizfunction stackName pathget length(path)repeat with i = it down to 1if char i of path = ":" then return char (i+1) to it of pathend repeatreturn pathend stackNamefunction okNum L,H,D,askMsg -- low,high,default,messageput TRUE into validask askMsg with Dif it = empty then exit to HyperCardput it into nif n is a number and n ‚â• L and n ‚⧠H then return nif L = H then get "Entry must be"&&L else get "Entry must be between"&&L&&"and"&&Hanswer "ENTRY ERROR:"&return&quote&n&quote&&"not a valid number."&return&it&"." with "Cancel" or "Reenter"if it is "Cancel" then exit to HyperCardelse return okNum(L,H,D,askMsg) -- recurses until valid or cancelledend okNumfunction setCompactThresholdget the short name of cd btn id 10 of cd "preferences"if it = "Always" then get ">0%"delete first char of itdelete last char of itput it/100 into compactThresholdreturn compactThresholdend setCompactThreshold</script>
  17.     <background id="5539" file="background_5539.xml" name="Editor" />
  18.     <background id="5910" file="background_5910.xml" name="utility" />
  19.     <card id="2292" file="card_2292.xml" marked="false" name="Index" owner="5910" />
  20.     <card id="4675" file="card_4675.xml" marked="false" name="" owner="5539" />
  21.     <card id="2548" file="card_2548.xml" marked="false" name="masterHeaders" owner="5539" />
  22.     <card id="4154" file="card_4154.xml" marked="false" name="masterFooters" owner="5539" />
  23.     <card id="7255" file="card_7255.xml" marked="false" name="preferences" owner="5910" />
  24. </stack>
  25.